<template>
<div class="app">
  <div class="list">
    <div class="ite" v-for="item in list" :key="item.id" @click="getDetail(item.id)">
        <div class="left">
            <img :src="item.img" alt="">
        </div>
        <div class="right">
            <h4>{{item.nm}}</h4>
            <p>观众评分:{{item.sc}}</p>
            <p>主演：{{item.star}}</p>
            <p>{{item.showInfo}}</p>
        </div>
    </div>
  </div>
</div>
</template>

<script>
import axios from 'axios'
export default {
  data () {
    return {
      list: []
    }
  },
  methods: {
    getDetail (id) {
      // console.log(`跳转传值 ${id}`)
      // this.$router: 路由实例对象，可以用来跳转页面
      // this.$route: 当前页面的路由信息（包括当前地址，地址中的参数）
      this.$router.push(`/detail?id=${id}`)
    }
  },
  mounted () {
    axios.post('/datalist').then(res => {
      // console.log(res.data.movieList)
      this.list = res.data.movieList
    })
  }
}
</script>

<style>

</style>
